home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / doc / python-launchpad-bugs / examples / duplicate-test-file-check.py < prev    next >
Encoding:
Python Source  |  2009-01-08  |  1.2 KB  |  36 lines

  1. #!/usr/bin/env python
  2. #
  3. # This script will check a bug report's duplicates for attachments
  4. # and print the name of the attachment and the bug that the 
  5. # attachment is attached to.  It's useful for finding files for
  6. # testing apport crash reports.
  7. #
  8. # Copyright 2008 Canonical, Ltd
  9. # Author: Brian Murray <brian@canonical.com>
  10. # Licensed under the GNU General Public License, version 3.
  11.  
  12. from launchpadbugs.connector import ConnectBug
  13. import sys
  14. import os
  15.  
  16. Bug = ConnectBug('text')
  17. Bug.authentication= os.path.expanduser('~/.lpcookie.txt')
  18.  
  19. # don't list the following attachments
  20. apport_attachments = [ 'Dependencies.txt', 'Disassembly.txt', 'ProcMaps.txt', 'ProcStatus.txt', 'Registers.txt', 'Stacktrace.txt', 'ThreadStacktrace.txt', 'CoreDump.gz', 'Traceback.txt' ]
  21.  
  22. def getattachments(number):
  23.     bug = Bug(number)
  24.  
  25.     for dup in bug.duplicates:
  26.         getattachments(dup)
  27.     
  28.     if bug.attachments:
  29.         for attachment in bug.attachments:
  30.             if attachment.lp_filename not in apport_attachments:
  31.                 print 'http://launchpad.net/bugs/%s: %s' % (bug.bugnumber, attachment.lp_filename)
  32.  
  33. master_bug = sys.argv[1]
  34.             
  35. getattachments(master_bug)
  36.